<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Bayesian Network: bayesian/network.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Bayesian Network
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_4922399365a46b010edf8e4eee2a5dfb.html">bayesian</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">network.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="network_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#ifndef BAYESIAN_NETWORKS_NETWORK_HPP</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#define BAYESIAN_NETWORKS_NETWORK_HPP</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;</div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &lt;memory&gt;</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;exception&gt;</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="component_8hpp.html">bayesian/network/component.hpp</a>&gt;</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;</div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacebn.html">bn</a> {</div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;</div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;</div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">class</span> RepresentMethod&gt;</div><div class="line"><a name="l00022"></a><span class="lineno"><a class="line" href="classbn_1_1network.html">   22</a></span>&#160;<span class="keyword">class </span><a class="code" href="classbn_1_1network.html">network</a> {</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;    <span class="keyword">using</span> <a class="code" href="classbn_1_1network.html">this_type</a> = <a class="code" href="classbn_1_1network.html">network&lt;RepresentMethod&gt;</a>;</div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;    <span class="keyword">using</span> random_variable_ptr = component::random_variable_ptr;</div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;    <span class="keyword">using</span> node_ptr = component::node_ptr;</div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;    <span class="keyword">using</span> arc_ptr = component::arc_ptr;</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;</div><div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="classbn_1_1network.html#abf7045b25b5b039a4febb1d26a5698ae">   30</a></span>&#160;    <a class="code" href="classbn_1_1network.html#abf7045b25b5b039a4febb1d26a5698ae">network</a>()</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;        : pimpl_(new RepresentMethod())</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;    {</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;    }</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;    <a class="code" href="classbn_1_1network.html#abf7045b25b5b039a4febb1d26a5698ae">network</a>(this_type&amp;&amp;) = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;    <span class="keyword">virtual</span> <a class="code" href="classbn_1_1network.html#a3a100a94f5abacefdf15cc5ac32cddad">~network</a>() = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;    this_type&amp; <a class="code" href="classbn_1_1network.html#af8e0c93f5dfadb0f689c4e0d978eefaf">operator=</a>(this_type&amp;&amp;) = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;</div><div class="line"><a name="l00051"></a><span class="lineno"><a class="line" href="classbn_1_1network.html#ae0fed0b2e627a05dc68b33758aa1efec">   51</a></span>&#160;    <a class="code" href="classbn_1_1network.html">this_type</a> <a class="code" href="classbn_1_1network.html#ae0fed0b2e627a05dc68b33758aa1efec">clone</a>()<span class="keyword"> const</span></div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;        std::unique_ptr&lt;RepresentMethod&gt; copied_ptr(<span class="keyword">new</span> RepresentMethod(*pimpl_));</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="classbn_1_1network.html">this_type</a>(std::move(copied_ptr));</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;    }</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;</div><div class="line"><a name="l00062"></a><span class="lineno"><a class="line" href="classbn_1_1network.html#a0d582c74fa4a517b73ebce372bc779aa">   62</a></span>&#160;    node_ptr <a class="code" href="classbn_1_1network.html#a0d582c74fa4a517b73ebce372bc779aa">add_node</a>()</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    {</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;        random_variable_ptr rv(<span class="keyword">new</span> <a class="code" href="classbn_1_1component_1_1random__variable.html">component::random_variable</a>());</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;        node_ptr new_node(<span class="keyword">new</span> <a class="code" href="classbn_1_1component_1_1node.html">component::node</a>(rv));</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;        <span class="keywordflow">return</span> pimpl_-&gt;add_node(new_node);</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    }</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;</div><div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="classbn_1_1network.html#a6cadce82d9ce19904b6db978e3bb7ad7">   76</a></span>&#160;    node_ptr <a class="code" href="classbn_1_1network.html#a6cadce82d9ce19904b6db978e3bb7ad7">add_clone_node</a>(node_ptr <span class="keyword">const</span>&amp; node)</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    {</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;        node_ptr ptr(<span class="keyword">new</span> <a class="code" href="classbn_1_1component_1_1node.html">component::node</a>(node-&gt;get()));</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;        <span class="keywordflow">return</span> pimpl_-&gt;add_node(ptr);</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;    }</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;</div><div class="line"><a name="l00088"></a><span class="lineno"><a class="line" href="classbn_1_1network.html#a2aeea07c914e9592f42ba813b44cca8c">   88</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classbn_1_1network.html#a2aeea07c914e9592f42ba813b44cca8c">remove_node</a>(node_ptr <span class="keyword">const</span>&amp; node)</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    {</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;        <span class="keywordflow">return</span> pimpl_-&gt;remove_node(node);</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;    }</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;</div><div class="line"><a name="l00095"></a><span class="lineno"><a class="line" href="classbn_1_1network.html#a81ae2590eed588d4d6faa6febe250081">   95</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classbn_1_1network.html#a81ae2590eed588d4d6faa6febe250081">remove_all_node</a>()</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;    {</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;        <span class="comment">//TODO: there are some improvements</span></div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;        <span class="keywordflow">for</span>(<span class="keyword">auto</span> <span class="keyword">const</span>&amp; node : pimpl_-&gt;all_node())</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;        {</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;            pimpl_-&gt;remove_node(node);</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;        }</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;    }</div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;</div><div class="line"><a name="l00111"></a><span class="lineno"><a class="line" href="classbn_1_1network.html#ae7ea456102913924b5b52921c7e5c8c9">  111</a></span>&#160;    arc_ptr <a class="code" href="classbn_1_1network.html#ae7ea456102913924b5b52921c7e5c8c9">add_arc</a>(node_ptr <span class="keyword">const</span>&amp; from, node_ptr <span class="keyword">const</span>&amp; to)</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;    {</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;        arc_ptr new_arc(<span class="keyword">new</span> <a class="code" href="classbn_1_1component_1_1arc.html">component::arc</a>());</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;        <span class="keywordflow">return</span> pimpl_-&gt;add_arc(new_arc, from, to);</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;    }</div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;</div><div class="line"><a name="l00123"></a><span class="lineno"><a class="line" href="classbn_1_1network.html#a4170f84c9bff50bcb7e1882f42665741">  123</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classbn_1_1network.html#a4170f84c9bff50bcb7e1882f42665741">remove_arc</a>(arc_ptr <span class="keyword">const</span>&amp; arc)</div><div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;    {</div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;        <span class="keywordflow">return</span> pimpl_-&gt;remove_arc(arc);</div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;    }</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;</div><div class="line"><a name="l00135"></a><span class="lineno"><a class="line" href="classbn_1_1network.html#a014eee9086d6a3b3e514f6eebb3d2dc3">  135</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classbn_1_1network.html#a014eee9086d6a3b3e514f6eebb3d2dc3">remove_arc</a>(node_ptr <span class="keyword">const</span>&amp; from, node_ptr <span class="keyword">const</span>&amp; to)</div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;    {</div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;        <span class="keywordflow">return</span> pimpl_-&gt;remove_arc(from, to);</div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;    }</div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;</div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;</div><div class="line"><a name="l00142"></a><span class="lineno"><a class="line" href="classbn_1_1network.html#a06fa4a9a05f553ccaa7fff4cd8535c5b">  142</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classbn_1_1network.html#a06fa4a9a05f553ccaa7fff4cd8535c5b">remove_all_arc</a>()</div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;    {</div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;        <span class="comment">//TODO: there are some improvements</span></div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;        <span class="keywordflow">for</span> (<span class="keyword">auto</span> <span class="keyword">const</span>&amp; arc : pimpl_-&gt;all_arc())</div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;        {</div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;            pimpl_-&gt;remove_arc(arc);</div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;        }</div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;    }</div><div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;</div><div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;</div><div class="line"><a name="l00156"></a><span class="lineno"><a class="line" href="classbn_1_1network.html#ae22fba0693624b0fb198556de75374c3">  156</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classbn_1_1network.html#ae22fba0693624b0fb198556de75374c3">change_direction</a>(arc_ptr <span class="keyword">const</span>&amp; arc)</div><div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;    {</div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;        <span class="comment">// Eraseable (that is, whether the arc exists or not)</span></div><div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;        <span class="keyword">auto</span> <span class="keyword">const</span> new_source = pimpl_-&gt;target(arc);</div><div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;        <span class="keyword">auto</span> <span class="keyword">const</span> new_target = pimpl_-&gt;source(arc);</div><div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;        <span class="keywordflow">if</span>(!new_source || !new_target) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;</div><div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;        <span class="comment">// Try remove</span></div><div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;        <span class="keywordflow">if</span>(!pimpl_-&gt;remove_arc(arc)) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;</div><div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;        <span class="comment">// Try addition of inversed arc</span></div><div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;        <span class="keywordflow">if</span>(!pimpl_-&gt;add_arc(arc, new_source, new_target))</div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;        {</div><div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;            <span class="comment">// Restore</span></div><div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;            <span class="keywordflow">if</span>(!pimpl_-&gt;add_arc(arc, new_source, new_target))</div><div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;            {</div><div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;                <span class="comment">//TODO: Libraries Exception</span></div><div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;                <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;&quot;</span>);</div><div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;            }</div><div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;        }</div><div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;</div><div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;    }</div><div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;</div><div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;</div><div class="line"><a name="l00187"></a><span class="lineno"><a class="line" href="classbn_1_1network.html#a4dc7817763b4b970779af69fdcb49a95">  187</a></span>&#160;    arc_ptr <a class="code" href="classbn_1_1network.html#a4dc7817763b4b970779af69fdcb49a95">is_adjacent</a>(node_ptr <span class="keyword">const</span>&amp; from, node_ptr <span class="keyword">const</span>&amp; to) <span class="keyword">const</span> noexcept</div><div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;    {</div><div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;        <span class="keywordflow">return</span> pimpl_-&gt;is_adjacent(from, to);</div><div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;    }</div><div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;</div><div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;</div><div class="line"><a name="l00201"></a><span class="lineno"><a class="line" href="classbn_1_1network.html#af34a74404c54d434a464c5ce567e763c">  201</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="classbn_1_1network.html#af34a74404c54d434a464c5ce567e763c">is_connect</a>(node_ptr <span class="keyword">const</span>&amp; node, arc_ptr <span class="keyword">const</span>&amp; arc) <span class="keyword">const</span> noexcept</div><div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;    {</div><div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;        <span class="keywordflow">return</span> pimpl_-&gt;is_connect(node, arc);</div><div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;    }</div><div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;</div><div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;</div><div class="line"><a name="l00212"></a><span class="lineno"><a class="line" href="classbn_1_1network.html#a9ac727efbdd02af8baa146820a7ea9fa">  212</a></span>&#160;    node_ptr <a class="code" href="classbn_1_1network.html#a9ac727efbdd02af8baa146820a7ea9fa">source</a>(arc_ptr <span class="keyword">const</span>&amp; arc)<span class="keyword"> const</span></div><div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;        <span class="keywordflow">return</span> pimpl_-&gt;source(arc);</div><div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;    }</div><div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;</div><div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;</div><div class="line"><a name="l00223"></a><span class="lineno"><a class="line" href="classbn_1_1network.html#a3d49c65254a82ce519f71bef043ffd8e">  223</a></span>&#160;    node_ptr <a class="code" href="classbn_1_1network.html#a3d49c65254a82ce519f71bef043ffd8e">target</a>(arc_ptr <span class="keyword">const</span>&amp; arc)<span class="keyword"> const</span></div><div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;        <span class="keywordflow">return</span> pimpl_-&gt;target(arc);</div><div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;    }</div><div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;</div><div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;</div><div class="line"><a name="l00234"></a><span class="lineno"><a class="line" href="classbn_1_1network.html#a5b641504686e299eb9f988e51b77e827">  234</a></span>&#160;    std::vector&lt;node_ptr&gt; <a class="code" href="classbn_1_1network.html#a5b641504686e299eb9f988e51b77e827">parent_nodes</a>(node_ptr <span class="keyword">const</span>&amp; node)<span class="keyword"> const</span></div><div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;        <span class="keywordflow">return</span> pimpl_-&gt;parent_nodes(node);</div><div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;    }</div><div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;</div><div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;</div><div class="line"><a name="l00245"></a><span class="lineno"><a class="line" href="classbn_1_1network.html#ac1d37fde77b3deb984b552ef7cec7f52">  245</a></span>&#160;    std::vector&lt;node_ptr&gt; <a class="code" href="classbn_1_1network.html#ac1d37fde77b3deb984b552ef7cec7f52">child_nodes</a>(node_ptr <span class="keyword">const</span>&amp; node)<span class="keyword"> const</span></div><div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;        <span class="keywordflow">return</span> pimpl_-&gt;child_nodes(node);</div><div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;    }</div><div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;</div><div class="line"><a name="l00251"></a><span class="lineno"><a class="line" href="classbn_1_1network.html#ac1cbce2d87b6a6aaa76432e8b63bf15d">  251</a></span>&#160;    std::vector&lt;node_ptr&gt; <a class="code" href="classbn_1_1network.html#ac1cbce2d87b6a6aaa76432e8b63bf15d">all_node</a>()<span class="keyword"> const</span></div><div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;        <span class="keywordflow">return</span> pimpl_-&gt;all_node();</div><div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;    }</div><div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;</div><div class="line"><a name="l00257"></a><span class="lineno"><a class="line" href="classbn_1_1network.html#a1c1237e61bc8ea0143e6686fc8fca4a9">  257</a></span>&#160;    std::vector&lt;arc_ptr&gt; <a class="code" href="classbn_1_1network.html#a1c1237e61bc8ea0143e6686fc8fca4a9">all_arc</a>()<span class="keyword"> const</span></div><div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;        <span class="keywordflow">return</span> pimpl_-&gt;all_arc();</div><div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;    }</div><div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;</div><div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;    <a class="code" href="classbn_1_1network.html#abf7045b25b5b039a4febb1d26a5698ae">network</a>(std::unique_ptr&lt;RepresentMethod&gt; pimpl)</div><div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;        : pimpl_(std::move(pimpl))</div><div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;    {</div><div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;    }</div><div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;</div><div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;    std::unique_ptr&lt;RepresentMethod&gt; pimpl_;</div><div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;};</div><div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;</div><div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;} <span class="comment">// namespace bn</span></div><div class="line"><a name="l00272"></a><span class="lineno">  272</span>&#160;</div><div class="line"><a name="l00273"></a><span class="lineno">  273</span>&#160;<span class="preprocessor">#endif // BAYESIAN_NETWORKS_NETWORK_HPP</span></div><div class="ttc" id="namespacebn_html"><div class="ttname"><a href="namespacebn.html">bn</a></div><div class="ttdef"><b>Definition:</b> algorithm.hpp:16</div></div>
<div class="ttc" id="classbn_1_1network_html_abf7045b25b5b039a4febb1d26a5698ae"><div class="ttname"><a href="classbn_1_1network.html#abf7045b25b5b039a4febb1d26a5698ae">bn::network::network</a></div><div class="ttdeci">network()</div><div class="ttdoc">(Default ctor) Initialize nodes and arcs as empty. </div><div class="ttdef"><b>Definition:</b> network.hpp:30</div></div>
<div class="ttc" id="classbn_1_1network_html_a014eee9086d6a3b3e514f6eebb3d2dc3"><div class="ttname"><a href="classbn_1_1network.html#a014eee9086d6a3b3e514f6eebb3d2dc3">bn::network::remove_arc</a></div><div class="ttdeci">bool remove_arc(node_ptr const &amp;from, node_ptr const &amp;to)</div><div class="ttdoc">Remove the argument arc from network. </div><div class="ttdef"><b>Definition:</b> network.hpp:135</div></div>
<div class="ttc" id="classbn_1_1network_html_a3d49c65254a82ce519f71bef043ffd8e"><div class="ttname"><a href="classbn_1_1network.html#a3d49c65254a82ce519f71bef043ffd8e">bn::network::target</a></div><div class="ttdeci">node_ptr target(arc_ptr const &amp;arc) const</div><div class="ttdoc">Obtain a target (child) node of an arc. </div><div class="ttdef"><b>Definition:</b> network.hpp:223</div></div>
<div class="ttc" id="classbn_1_1component_1_1node_html"><div class="ttname"><a href="classbn_1_1component_1_1node.html">bn::component::node</a></div><div class="ttdoc">A class representing a node in network. </div><div class="ttdef"><b>Definition:</b> component.hpp:30</div></div>
<div class="ttc" id="classbn_1_1network_html_ae22fba0693624b0fb198556de75374c3"><div class="ttname"><a href="classbn_1_1network.html#ae22fba0693624b0fb198556de75374c3">bn::network::change_direction</a></div><div class="ttdeci">bool change_direction(arc_ptr const &amp;arc)</div><div class="ttdoc">Change a direction of argument arc. </div><div class="ttdef"><b>Definition:</b> network.hpp:156</div></div>
<div class="ttc" id="classbn_1_1network_html_a1c1237e61bc8ea0143e6686fc8fca4a9"><div class="ttname"><a href="classbn_1_1network.html#a1c1237e61bc8ea0143e6686fc8fca4a9">bn::network::all_arc</a></div><div class="ttdeci">std::vector&lt; arc_ptr &gt; all_arc() const</div><div class="ttdoc">Obtain all arc pointers. </div><div class="ttdef"><b>Definition:</b> network.hpp:257</div></div>
<div class="ttc" id="classbn_1_1network_html_a4170f84c9bff50bcb7e1882f42665741"><div class="ttname"><a href="classbn_1_1network.html#a4170f84c9bff50bcb7e1882f42665741">bn::network::remove_arc</a></div><div class="ttdeci">bool remove_arc(arc_ptr const &amp;arc)</div><div class="ttdoc">Remove the argument arc from network. </div><div class="ttdef"><b>Definition:</b> network.hpp:123</div></div>
<div class="ttc" id="classbn_1_1network_html_a3a100a94f5abacefdf15cc5ac32cddad"><div class="ttname"><a href="classbn_1_1network.html#a3a100a94f5abacefdf15cc5ac32cddad">bn::network::~network</a></div><div class="ttdeci">virtual ~network()=default</div><div class="ttdoc">(Default dtor) </div></div>
<div class="ttc" id="classbn_1_1network_html_af34a74404c54d434a464c5ce567e763c"><div class="ttname"><a href="classbn_1_1network.html#af34a74404c54d434a464c5ce567e763c">bn::network::is_connect</a></div><div class="ttdeci">int is_connect(node_ptr const &amp;node, arc_ptr const &amp;arc) const noexcept</div><div class="ttdoc">Check whether a node and an arc are connected in the network. </div><div class="ttdef"><b>Definition:</b> network.hpp:201</div></div>
<div class="ttc" id="classbn_1_1network_html"><div class="ttname"><a href="classbn_1_1network.html">bn::network</a></div><div class="ttdoc">Provide a functions for each graph representing class. </div><div class="ttdef"><b>Definition:</b> network.hpp:22</div></div>
<div class="ttc" id="component_8hpp_html"><div class="ttname"><a href="component_8hpp.html">component.hpp</a></div><div class="ttdoc">Implementations of important elements of bn::network. </div></div>
<div class="ttc" id="classbn_1_1network_html_a06fa4a9a05f553ccaa7fff4cd8535c5b"><div class="ttname"><a href="classbn_1_1network.html#a06fa4a9a05f553ccaa7fff4cd8535c5b">bn::network::remove_all_arc</a></div><div class="ttdeci">void remove_all_arc()</div><div class="ttdoc">Remove all arcs from network. </div><div class="ttdef"><b>Definition:</b> network.hpp:142</div></div>
<div class="ttc" id="classbn_1_1network_html_a0d582c74fa4a517b73ebce372bc779aa"><div class="ttname"><a href="classbn_1_1network.html#a0d582c74fa4a517b73ebce372bc779aa">bn::network::add_node</a></div><div class="ttdeci">node_ptr add_node()</div><div class="ttdoc">Register a node into network. </div><div class="ttdef"><b>Definition:</b> network.hpp:62</div></div>
<div class="ttc" id="classbn_1_1component_1_1random__variable_html"><div class="ttname"><a href="classbn_1_1component_1_1random__variable.html">bn::component::random_variable</a></div><div class="ttdoc">A class representing a random variable. </div><div class="ttdef"><b>Definition:</b> component.hpp:21</div></div>
<div class="ttc" id="classbn_1_1network_html_a6cadce82d9ce19904b6db978e3bb7ad7"><div class="ttname"><a href="classbn_1_1network.html#a6cadce82d9ce19904b6db978e3bb7ad7">bn::network::add_clone_node</a></div><div class="ttdeci">node_ptr add_clone_node(node_ptr const &amp;node)</div><div class="ttdoc">Register a cloned node of the argument into network. </div><div class="ttdef"><b>Definition:</b> network.hpp:76</div></div>
<div class="ttc" id="classbn_1_1network_html_ae7ea456102913924b5b52921c7e5c8c9"><div class="ttname"><a href="classbn_1_1network.html#ae7ea456102913924b5b52921c7e5c8c9">bn::network::add_arc</a></div><div class="ttdeci">arc_ptr add_arc(node_ptr const &amp;from, node_ptr const &amp;to)</div><div class="ttdoc">Register an arc into network. </div><div class="ttdef"><b>Definition:</b> network.hpp:111</div></div>
<div class="ttc" id="classbn_1_1network_html_a4dc7817763b4b970779af69fdcb49a95"><div class="ttname"><a href="classbn_1_1network.html#a4dc7817763b4b970779af69fdcb49a95">bn::network::is_adjacent</a></div><div class="ttdeci">arc_ptr is_adjacent(node_ptr const &amp;from, node_ptr const &amp;to) const noexcept</div><div class="ttdoc">Check whether two nodes are adjacent by a arc in the network. </div><div class="ttdef"><b>Definition:</b> network.hpp:187</div></div>
<div class="ttc" id="classbn_1_1network_html_ae0fed0b2e627a05dc68b33758aa1efec"><div class="ttname"><a href="classbn_1_1network.html#ae0fed0b2e627a05dc68b33758aa1efec">bn::network::clone</a></div><div class="ttdeci">this_type clone() const</div><div class="ttdoc">Clone this instance. </div><div class="ttdef"><b>Definition:</b> network.hpp:51</div></div>
<div class="ttc" id="classbn_1_1network_html_a5b641504686e299eb9f988e51b77e827"><div class="ttname"><a href="classbn_1_1network.html#a5b641504686e299eb9f988e51b77e827">bn::network::parent_nodes</a></div><div class="ttdeci">std::vector&lt; node_ptr &gt; parent_nodes(node_ptr const &amp;node) const</div><div class="ttdoc">Obtain a list of all nodes which are parent of the child (argument). </div><div class="ttdef"><b>Definition:</b> network.hpp:234</div></div>
<div class="ttc" id="classbn_1_1network_html_a81ae2590eed588d4d6faa6febe250081"><div class="ttname"><a href="classbn_1_1network.html#a81ae2590eed588d4d6faa6febe250081">bn::network::remove_all_node</a></div><div class="ttdeci">void remove_all_node()</div><div class="ttdoc">Remove all nodes from network. </div><div class="ttdef"><b>Definition:</b> network.hpp:95</div></div>
<div class="ttc" id="classbn_1_1component_1_1arc_html"><div class="ttname"><a href="classbn_1_1component_1_1arc.html">bn::component::arc</a></div><div class="ttdoc">A class representing a arc in network. </div><div class="ttdef"><b>Definition:</b> component.hpp:52</div></div>
<div class="ttc" id="classbn_1_1network_html_af8e0c93f5dfadb0f689c4e0d978eefaf"><div class="ttname"><a href="classbn_1_1network.html#af8e0c93f5dfadb0f689c4e0d978eefaf">bn::network::operator=</a></div><div class="ttdeci">this_type &amp; operator=(this_type &amp;&amp;)=default</div><div class="ttdoc">(Move operator=) Initialize nodes and arcs by copying a parameter. </div></div>
<div class="ttc" id="classbn_1_1network_html_a2aeea07c914e9592f42ba813b44cca8c"><div class="ttname"><a href="classbn_1_1network.html#a2aeea07c914e9592f42ba813b44cca8c">bn::network::remove_node</a></div><div class="ttdeci">bool remove_node(node_ptr const &amp;node)</div><div class="ttdoc">Remove the argument node from network. </div><div class="ttdef"><b>Definition:</b> network.hpp:88</div></div>
<div class="ttc" id="classbn_1_1network_html_ac1cbce2d87b6a6aaa76432e8b63bf15d"><div class="ttname"><a href="classbn_1_1network.html#ac1cbce2d87b6a6aaa76432e8b63bf15d">bn::network::all_node</a></div><div class="ttdeci">std::vector&lt; node_ptr &gt; all_node() const</div><div class="ttdoc">Obtain all node pointers. </div><div class="ttdef"><b>Definition:</b> network.hpp:251</div></div>
<div class="ttc" id="classbn_1_1network_html_a9ac727efbdd02af8baa146820a7ea9fa"><div class="ttname"><a href="classbn_1_1network.html#a9ac727efbdd02af8baa146820a7ea9fa">bn::network::source</a></div><div class="ttdeci">node_ptr source(arc_ptr const &amp;arc) const</div><div class="ttdoc">Obtain a source (parent) node of an arc. </div><div class="ttdef"><b>Definition:</b> network.hpp:212</div></div>
<div class="ttc" id="classbn_1_1network_html_ac1d37fde77b3deb984b552ef7cec7f52"><div class="ttname"><a href="classbn_1_1network.html#ac1d37fde77b3deb984b552ef7cec7f52">bn::network::child_nodes</a></div><div class="ttdeci">std::vector&lt; node_ptr &gt; child_nodes(node_ptr const &amp;node) const</div><div class="ttdoc">Obtain a list of all nodes which are child of the parent (argument). </div><div class="ttdef"><b>Definition:</b> network.hpp:245</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>
